*{
    margin: 0;
    padding: 0;
}
ul{
    width: 600px;
    margin: auto;
    list-style: none;
}
li{
    position: relative;
    text-align: center;
    line-height: 40px;
    width: 120px;
    height: 40px;
    background:red;
    float: left;
}
.clearfix{
    content: '';
    display: block;
    clear: both;
}
li > a{ 
    display: block;
    color: white;
    text-decoration: none;
}
li > div{
    position: absolute;
    width: 100%;
    overflow: hidden;
    height: 0;
    transition:all 0.4s;
}
li > div > div{
    background: linear-gradient(90deg,green,rgb(119, 238, 175));
    height: 40px;
    text-align: center;
    line-height: 40px;
    cursor: pointer;
}